package com.qikux.controller;

import com.qikux.entity.User;
import com.qikux.service.UserService;
import com.qikux.vo.ResultVo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;

@Controller
@RequestMapping("/user")
public class UserController {

    @Resource
    private UserService userService;

    @GetMapping("/add")
    public ModelAndView index(){

        return new ModelAndView("user");
    }

    @PostMapping("/add")
    public ResultVo add(User user){

        return userService.addUser(user);
    }
}
